from CaseElementsPage.LoginPage import LoginPage # todo：引入登录的page页
from BaseDriver.basedriver import BaseDriver  # todo：实例化一个driver
from BaseDriver.appium_server import kill_appium_server # todo：杀死appium 服务
import pytest,allure
from Config.GetLogger import Logger

@allure.feature("小豆苗医疗APP")
class TestLogin():
    @pytest.fixture(scope='function',autouse=True)
    @allure.story("driver初始化方法")
    def setup_teardown(self):
        self.driver = BaseDriver('YeShen').base_driver()
        self.log = Logger.log('Test')
        self.log.debug('驱动已准备就绪，开始测试')
        self.driver.implicitly_wait(15)
        self.log.debug('设置隐式等待')
        yield
        self.log.debug('用例执行结束，正在退出...')
        self.driver.quit()
        self.log.debug('已退出测试')
        kill_appium_server('4723')
    @allure.story("登录")
    def test_one(self):
        self.log.debug('开始执行测试一下用例')
        self.driver_ = LoginPage(self.driver)
        self.log.debug('实例化LoginPage')
        self.driver_.click_allow()
        self.log.debug('点击同意隐私政策')
        self.driver_.press_introducer()
        self.log.debug('滑动两次引导页')
        self.driver_.click_experience()
        self.log.debug('点击立即体验')
        self.driver_.click_read()
        self.log.debug('点击阅读')
        self.driver_.click_phone_login()
        self.log.debug("点击手机号登录")
        self.driver_.input_content()
        self.log.debug("输入内容")
        self.driver_.Send_verification_code()
        self.log.debug("发送验证码")
        self.driver_.assert_content()
        self.log.debug("断言文本内容")

